
import {fetch, fetchGet, fetchBlob} from "./index.js";

const api = "";


// 当前用户
const updateUserApi = params => {
  return fetch(`${api}/user/updateUserInfo`, params)
}

// 当前用户
const getCurrentUserApi = params => {
  return fetchGet(`${api}/user/getCurrentUser`, params)
}

// 手机发送短信验证码
const sendLoginCodeApi = params => {
  return fetch(`${api}/userLogin/sendLoginCode`, params)
}

// 手机号/短信验证码，实现登录
const loginApi = params => {
  return fetch(`${api}/userLogin/login`, params)
}

// 获取当前用户信息
const initPageApi = params => {
  return fetch(`${api}/home/initPage`, params)
}

// 主播点击开播
const startingLivingApi = params => {
  return fetchGet(`${api}/living/startingLiving`, params)
}

// 获取主播相关配置信息（只有主播才会有权限）
const anchorConfigApi = params => {
  return fetchGet(`${api}/living/anchorConfig`, params)
}

// 主播点击关播
const closeLivingApi = params => {
  return fetchGet(`${api}/living/closeLiving`, params)
}


// 直播间列表
const getLivingListApi = params => {
  return fetch(`${api}/living/list`, params)
}


// 直播间列表
const getImConfigApi = params => {
  return fetch(`${api}/im/getImConfig`, params)
}

// 获取礼物列表
const getGiftListApi = params => {
  return fetch(`${api}/gift/listGift`, params)
}

//发送礼物
const sendGiftApi = params => {
  return fetch(`${api}/gift/send`, params)
}

// 支付产品列表
const getProductsApi = params => {
  return fetchGet(`${api}/bank/products`, params)
}

// 支付购买产品
const payProductApi = params => {
  return fetch(`${api}/bank/payProduct`, params)
}

// pk连线主播
const onlinePkApi = params => {
  return fetch(`${api}/living/onlinePk`, params)
}

// 初始化红包雨
const prepareRedPacketApi = params => {
  return fetch(`${api}/living/prepareRedPacket`, params)
}

// 主播开始派发红包雨
const startRedPacketApi = params => {
  return fetch(`${api}/living/startRedPacket`, params)
}

// 抢发红包
const getRedPacketApi = params => {
  return fetch(`${api}/living/getRedPacket`, params)
}

// 抢发红包
const listSkuInfoApi = params => {
  return fetchGet(`${api}/shop/listSkuInfo`, params)
}

const getProductListApi = params => {
  return fetchGet(`${api}/home/getProductList`, params)
}

const getProductByIdApi = params => {
  return fetchGet(`${api}/home/getProduct`, params)
}

const getProductLikeApi = params => {
  return fetchGet(`${api}/home/getProductLike`, params)
}

const getShopApi = params => {
  return fetchGet(`${api}/home/getShopInfo`, params)
}
const getCommentInfoListApi = params => {
  return fetchGet(`${api}/home/getCommentInfoList`, params)
}

const getProductByShopIdApi = params => {
  return fetchGet(`${api}/home/getProductByShopId`, params)
}

const getHomeDataApi = params => {
  return fetchGet(`${api}/home/data`, params)
}

const getOrderListByBuyerIdApi = params => {
  return fetch(`${api}/order/getOrderListByBuyerId`, params)
}

const getCategoryListApi = params => {
  return fetchGet(`${api}/home/getCategoryList`, params)
}

const getCouponListApi = params => {
  return fetchGet(`${api}/home/getCouponList`, params)
}

const createOrderApi = params => {
  return fetch(`${api}/order/createOrder`, params)
}

const getOrderByIdApi = params => {
  return fetchGet(`${api}/order/getOrderByOrderId`, params)
}

const getFriendListApi = params => {
  return fetchGet(`${api}/friend/friendList`, params)
}

const getChatInfoListApi = params => {
  return fetchGet(`${api}/chat/getChatListByUniqueCode`, params)
}

const findFriendsApi = params => {
  return fetchGet(`${api}/friend/findFriends`, params)
}

const addFriendApi = params => {
  return fetchGet(`${api}/friend/addFriend`, params)
}

const getGroupListApi = params => {
  return fetchGet(`${api}/friend/getGroupList`, params)
}

const getSendPermissionApi = params => {
  return fetchGet(`${api}/packetConfig/getSendPermission`, params)
}

const prepareRedPacketConfigApi = params => {
  return fetch(`${api}/packetConfig/prepareRedPacket`, params)
}


const sendRedPacketApi = params => {
  return fetch(`${api}/packetConfig/startRedPacket`, params)
}

// 抢发红包
const getRedPacketReqApi = params => {
  return fetch(`${api}/packetConfig/getRedPacket`, params)
}

// 消息
const getSessionListApi = params => {
  return fetchGet(`${api}/session/getSessionList`, params)
}

const saveAddressApi = params => {
  return fetch(`${api}/address/saveAddress`, params)
}


const getAddressListApi = params => {
  return fetchGet(`${api}/address/getAddressList`, params)
}


const getAddressByIdApi = params => {
  return fetchGet(`${api}/address/getAddressById`, params)
}


const deleteAddressApi = params => {
  return fetchGet(`${api}/address/deleteAddress`, params)
}

const deleteOrderByIdApi = params => {
  return fetchGet(`${api}/order/deleteOrderById`, params);

}

const getCommentProductApi = params => {
  return fetch(`${api}/comment/getCommentProduct`, params);
}

const getOrderDetailByIdApi = params => {
  return fetch(`${api}/comment/getOrderDetailById`, params);

}

const addOrderCommentApi = params => {
  return fetch(`${api}/comment/addOrderComment`, params);

}

const getCommentTotalByProductIdApi = params => {
  return fetchGet(`${api}/comment/getCommentTotalByProductId`, params);

}

const getProductListByTypeApi = params => {
  return fetch(`${api}/product/getProductListByType`, params);

}


const hasShopCollectApi = params => {
  return fetchGet(`${api}/shopCollect/hasShopCollect`, params);
}
const saveShopCollectApi = params => {
  return fetchGet(`${api}/shopCollect/saveShopCollect`, params);
}

const cancelShopCollectApi = params => {
  return fetchGet(`${api}/shopCollect/cancelShopCollect`, params);
}


const hasProductCollectApi = params => {
  return fetchGet(`${api}/productCollect/hasProductCollect`, params);
}
const saveProductCollectApi = params => {
  return fetchGet(`${api}/productCollect/saveProductCollect`, params);
}

const cancelProductCollectApi = params => {
  return fetchGet(`${api}/productCollect/cancelProductCollect`, params);
}

const createPDFApi = params => {
  return fetchBlob(`${api}/pdf/createPDF`, params);
}














const reqApis = {
  updateUserApi,
  getCurrentUserApi,
  getProductListApi,
  loginApi,
  sendLoginCodeApi,
  initPageApi,
  startingLivingApi,
  closeLivingApi,
  anchorConfigApi,
  getLivingListApi,
  getImConfigApi,
  getGiftListApi,
  sendGiftApi,
  getProductsApi,
  payProductApi,
  onlinePkApi,
  prepareRedPacketApi,
  startRedPacketApi,
  getRedPacketApi,
  listSkuInfoApi,
  getProductLikeApi,
  getShopApi,
  getCommentInfoListApi,
  getProductByShopIdApi,
  getProductByIdApi,
  getHomeDataApi,
  getOrderListByBuyerIdApi,
  getCategoryListApi,
  getCouponListApi,
  createOrderApi,
  getOrderByIdApi,
  getFriendListApi,
  getChatInfoListApi,
  findFriendsApi,
  addFriendApi,
  getGroupListApi,
  getSendPermissionApi,
  prepareRedPacketConfigApi,
  sendRedPacketApi,
  getRedPacketReqApi,
  getSessionListApi,
  saveAddressApi,
  getAddressListApi,
  getAddressByIdApi,
  deleteAddressApi,
  deleteOrderByIdApi,
  getCommentProductApi,
  getOrderDetailByIdApi,
  addOrderCommentApi,
  getCommentTotalByProductIdApi,
  getProductListByTypeApi,
  hasShopCollectApi,
  saveShopCollectApi,
  cancelShopCollectApi,
  hasProductCollectApi,
  saveProductCollectApi,
  cancelProductCollectApi,
  createPDFApi
}
export default reqApis